<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>

// 1、用json的方式定义一个医生。

let doctor = {
    id:"01001", //属性
    name:"王大伟",
    sex:"男",
    dept:"内科",
    seatZhen:function(){ //方法
        console.log("坐诊中……");
    }
}

// 2、使用医生。
   console.log(doctor.name);
   doctor.seatZhen();
   
//---------------------------------------------------
// JSON数组
let doctors = [
        {
            id:"01001", //属性
            name:"王大伟",
            sex:"男",
            dept:"内科"
        },
        {
            id:"01002", //属性
            name:"大黄",
            sex:"男",
            dept:"外科"
        },
        {
            id:"01003", //属性
            name:"小白",
            sex:"女",
            dept:"妇科"
        }
    ]
// console.log(doctors[1].name);

for(let i=0;i<doctors.length;i++){
    console.log(doctors[i].name);
}
</script>
